// run: $exec < input
#include <iostream>
#include <string>

int n, m, k;
//std::string magic = "aababb";
std::string magic = "BABBAA";
std::string im = "Impossible";

int main()
{
	std::ios::sync_with_stdio(false);
	int T; std::cin >> T;
	for (int ti = 1; ti <= T; ti++) {
		if (ti > 1) std::cout << '\n';
		std::cout << "Case #" << ti << ":\n";
		std::cin >> n >> m >> k;
		if (m > n) { std::cout << im; continue; }
		if (n == m) {
			for (int i = 0; i < n; i++) std::cout << "A";
			continue;
		}

		if (k == 1) {
			std::cout << im;
			continue;
		}

		if (k >= 3) {
			if (m <= 2)
				std::cout << im;
			else {
				int ta = m - 2;
				for (int i = 0; i < ta - 1; i++)
					std::cout << "A";
				n -= ta - 1;
				for (int i = 0; i < n; i++)
					std::cout << char('A' + (i % 3));
			}
			continue;
		}

		if (k == 2) {
			if (n == 8 && m == 7) {
				std::cout << "AABABBAA";
				continue;
			}
			if (n <= 7) {
				if (n != m) {
					std::cout << im;
				} else {
					for (int i = 0; i < n; i++)
						std::cout << 'A';
				}
			} else {
				if (m < 8) {
					std::cout << im;
				} else if (n == m) {
					for (int i = 0; i < n; i++) std::cout << 'A';
				} else {
					// aababbaa  babbaa
					std::string ss = "AABABBAA";
					int tot = 8;
					for (; (int)ss.size() <= n; ) ss += magic;
					int tt = m - tot;
					for (int i = 0; i < tt; i++) std::cout << 'A';
					for (int i = 0; i < n - tt; i++) std::cout << ss[i];
				}
			}
			continue;
		}
	}
}

